﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

namespace Zero.Event
{
    public class Action_Trigger2D : MonoBehaviour
    {
        [Serializable]
        public class Event_OnTriggerEnter2D : UnityEvent
        {
        }

        [Serializable]
        public class Event_OnTriggerExit2D : UnityEvent
        {
        }

        public Event_OnTriggerEnter2D onTriggerEnter2D;
        public Event_OnTriggerExit2D onTriggerExit2D;

        private void OnTriggerEnter2D(Collider2D other)
        {
            if (other.CompareTag("Player"))
                onTriggerEnter2D?.Invoke();
        }

        private void OnTriggerExit2D(Collider2D other)
        {
            if (other.CompareTag("Player"))
                onTriggerExit2D?.Invoke();
        }
    }
}